<link href="<?php echo CSS_User_URL; ?> /Profile_Fields_style.css" rel="stylesheet" type="text/css"> 
<script src="<?php echo JS_User_URL; ?>/Profile_Fields_js.js" type="text/javascript"></script>
<div class="field_intro">

    <div class="field_intro_article"> 
        <h4 class="intro_title">Thêm các lĩnh vực mà bạn quan tâm</h4>
        <p class="Article_content">
            <?php echo $Intro->Value; ?>
            <!--Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.-->
        </p>
    </div>
    <div class="field_intro_image center-child"><img src="<?php echo Yii::app()->baseUrl; ?>/images/pencil (1).png" alt="Ideawebsite.com"></div>
</div>
<?php echo CHtml::dropDownList('LinhVuc', '', $LinhVuc, array('empty' => 'Chọn một danh mục')) ?>
<div class="DanhMucs"></div>
<script>
    $(document).ready(function() {
        function DanhMuc_Click(object) {
            var ID = object.attr('data-id');
            console.log(ID);
            var isNew;
            if (object.hasClass('field_choosen')) {
                isNew = 'OLD';
            } else {
                isNew = 'NEW';
            }
            URL = '<?php echo Yii::app()->createUrl('User/ToggleFollow'); ?>';
            $.post(URL, {ID: ID, isNew: isNew}, function(data) {
                if (data === 'success') {
                    if (isNew === 'NEW') {
                        object.addClass('field_choosen');
                    } else {
                        object.removeClass('field_choosen');
                    }
                } else {
                    alert('Có lỗi: ' + data);
                }
            });
        }
        $('#LinhVuc').change(function() {
            $('.DanhMucs').html('');
            var select = $(this).val();
            URL = '<?php echo Yii::app()->createUrl('User/GetDanhMuc'); ?>';
            $.post(URL, {select: select}, function(data) {
                $('.DanhMucs').html(data);
                $('.DanhMuc').unbind('click').click(function() {
                    DanhMuc_Click($(this));
                });
            });


        });

    });
</script>